'''
Created on 2011-3-11

@author: Holmes2
'''
import cPickle as p
import shutil,os

def del_user(account):

    dir0="D:\Program Files\Apache2.2\htdocs\py\Orderbook_2.0\data"
    os.chdir(dir0)
    dir=dir0+'\\'+account
    
    
    userlistfile='userlist.data'
    f = file(userlistfile)
    userlist = p.load(f)

    del userlist[account]
    #dir0="D:\Program Files\Apache2.2\htdocs\py\Orderbook_2.0\data"
    #dir=dir0+'\\'+account
    #print dir
    if os.path.exists(dir):
        shutil.rmtree(dir)
    else:
        return 1
    
    f = file(userlistfile, 'w')
    p.dump(userlist, f) 
    f.close()
    
del_user('677728')    
